/*
 * Created on 9 juin 2004
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package mygui;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import kernel.Simulator;


/**
 * @author flegall
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */


public class Delete extends JFrame
{
    private JLabel monLabel;
    private JButton oui; 
    private JButton non; 
    protected static JFrame sauve;
    public static int _x;
    private static int _y;
    protected static Simulator b;

    /**
     * Creates a frame
     * @param x
     * @param y
     * @param a
     */	
    public Delete(int x, int y,Simulator a){
	this.oui = new JButton("Yes");
	this.non = new JButton("No");
	monLabel = new JLabel("Do you really want to delete this object?");
	sauve = this;
	_x = x;
	_y = y;
	b = a;
		
	oui.addActionListener(new ActionListener(){

		public void actionPerformed(ActionEvent e) {
		    b.delete(_x,_y);
		    sauve.dispose();
		}
	    });
		
	non.addActionListener(new ActionListener(){

		public void actionPerformed(ActionEvent e) {
		    sauve.dispose();
		}
	    });
			
	this.getContentPane().setLayout(new GridLayout(2,1)); 
	JPanel a1 = new JPanel();
	a1.setLayout(new GridLayout(1,2));
	a1.add(oui);
	a1.add(non);
	this.getContentPane().add(monLabel); 
	this.getContentPane().add(a1); 
	this.setLocation(350,275);
	this.setSize(400,150); 
	this.setVisible(true);
    }
}	
	




